//
//  SPCommentFrame.m
//  Sport
//
//  Created by Cass on 2018/2/2.
//  Copyright © 2018年 Cass. All rights reserved.
//

#import "SPCommentFrame.h"
#import "YYTextLayout.h"
@interface SPCommentFrame()
@property (nonatomic, assign) CGRect textFrame;
@property (nonatomic, assign) CGFloat cellHeight;
@end
@implementation SPCommentFrame
- (void)setComment:(SPComment *)comment{
    _comment = comment;
    CGFloat textX = 11.0f;
    CGFloat textY = 7.0f;
    self.maxW = [UIScreen mainScreen].bounds.size.width;
    CGSize textLimitSize = CGSizeMake(self.maxW - 2 *textX, MAXFLOAT);
    CGFloat textH = [YYTextLayout layoutWithContainerSize:textLimitSize text:comment.attributedText].textBoundingSize.height;
    
    self.textFrame = (CGRect){{textX,textY},{textLimitSize.width,textH}};
    self.cellHeight = CGRectGetMaxY(self.textFrame) + 7.0f;
}
@end
